{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "gpuType": "T4",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/DrewThomasson/ebook2audiobookXTTS/blob/main/Notebooks/colab_ebook2audiobookxtts.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Welcome to the ebook2audiobookxtts free google colab!\n",
        "## 🌟 Features\n",
        "\n",
        "- 📖 Converts eBooks to text format with Calibre.\n",
        "- 📚 Splits eBook into chapters for organized audio.\n",
        "- 🎙️ High-quality text-to-speech with Coqui XTTS.\n",
        "- 🗣️ Optional voice cloning with your own voice file.\n",
        "- 🌍 Supports multiple languages! (English (en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Polish (pl), Turkish (tr), Russian (ru), Dutch (nl), Czech (cs), Arabic (ar), Chinese (zh-cn), Japanese (ja), Hungarian (hu), Korean (ko)).\n",
        "## Want to run locally for free? ⬇\n",
        "## [Check out the ebook2audiobookxtts github!](https://github.com/DrewThomasson/ebook2audiobookXTTS)"
      ],
      "metadata": {
        "id": "DKNNnwD-HJwQ"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# @title 🛠️ Install requirments\n",
        "#!DEBIAN_FRONTEND=noninteractive\n",
        "!sudo apt-get update # && sudo apt-get -y upgrade\n",
        "!sudo apt-get -y install libegl1\n",
        "!sudo apt-get -y install libopengl0\n",
        "!sudo apt-get -y install libxcb-cursor0\n",
        "!sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin\n",
        "!sudo apt-get install -y ffmpeg\n",
        "#!sudo apt-get install -y calibre\n",
        "!pip install ebook2audiobook-install-counter\n",
        "!pip install ebooklib\n",
        "!pip install pydub\n",
        "!pip install nltk\n",
        "!pip install beautifulsoup4\n",
        "!pip install tqdm\n",
        "!pip install gradio\n",
        "!pip install coqui-tts"
      ],
      "metadata": {
        "id": "Edxj355K0rUz",
        "collapsed": true,
        "cellView": "form"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# @title 🚀 Run ebook2audiobookxtts! (Make sure to set the runtime to have gpu to have faster generation speeds! :)\n",
        "#ntlk error fix\n",
        "#https://github.com/delip/PyTorchNLPBook/issues/14\n",
        "import nltk\n",
        "nltk.download('punkt')\n",
        "nltk.download('punkt_tab')\n",
        "\n",
        "#Auto agree to xtts\n",
        "import os\n",
        "os.environ[\"COQUI_TOS_AGREED\"] = \"1\"\n",
        "\n",
        "# To download the app.py and the Default_voice wav if not seen locally\n",
        "!wget -O /content/app.py https://raw.githubusercontent.com/DrewThomasson/ebook2audiobookXTTS/main/app.py\n",
        "!wget -O /content/default_voice.wav https://raw.githubusercontent.com/DrewThomasson/ebook2audiobookXTTS/main/default_voice.wav\n",
        "\n",
        "# Start the app with Share=True for the gradio interface\n",
        "!python /content/app.py --share True"
      ],
      "metadata": {
        "id": "658BTHueyLMo",
        "cellView": "form"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}
